<?php

/*
 * This class is used for as Model for Product table 
 */

class Model_Usertype extends Model_Base {

    protected $_name = 'member_usertype';
    protected $_primaryKey = 'ut_id';

    public function getStatusArray() {
        return array(
            "" => "-- Select Status --",
            "1" => "Active",
            "0" => "Inactive"
        );
    }
    
    public function fetchEntryById($id) {
        $select = $this->select()
                ->from(array("prtyp" => "member_usertype"))
                ->where("ut_id = ?", $id);
        $data = $this->fetchRow($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }
    
  
    
    
     public function fetchAllUsertype($where = "", $limit = "", $offset = "0", $order = 'ut_id', $sort = 'ASC') {
        
         $select = $this->select()
                ->from(array('prtyp' => 'member_usertype'));
        if ($where != '') {
            $select->where($where);
        }
        if ($limit != "") {
            $select->limit($limit, $offset);
        }
         #echo 'here';exit;
        
        $select->order($order . " " . $sort);
        $data = parent::fetchAll($select);
       if (!empty($data)) {
            $finalArray = array();
            foreach($data->toArray() as $_member_usertype) {
                $finalArray[$_member_usertype['ut_type']] = $_member_usertype['ut_type'];
            }
            return $finalArray;
        } else {
            return array();
        }
    }
    
  
    

}
